using System;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Text;
using System.Configuration;
using System.Security.Cryptography;

namespace _18miljard.Config
{
	public class WebConfig
	{
		public static ConnectionParameters ConnectionParameters
		{
			get	{ return WebConfig.GetConnectionParameters("connectionString"); }
		}

		public static ConnectionParameters MailConnectionParameters
		{
			get { return WebConfig.GetConnectionParameters("mailConnectionString"); }
		}

		public static ConnectionParameters AdConnectionParameters
		{
			get { return WebConfig.GetConnectionParameters("adConnectionString"); }
		}

		public static ConnectionParameters TempConnectionParameters
		{
			get { return WebConfig.GetConnectionParameters("tempConnectionString"); }
		}

		private static ConnectionParameters GetConnectionParameters(string key)
		{
			NameValueCollection values = ConfigurationManager.AppSettings;

			return new ConnectionParameters(values[key], null);
		}

		public static BotIpCollection BotIpCollection
		{
			get { return BotsByIpSection.GetConfig().BotIpCollection; }
		}

		public static int SmtpPort
		{
			get { return Convert.ToInt32(ConfigurationManager.AppSettings["smtpport"]); }
		}

		public static string BotPattern
		{
		    get { return ConfigurationManager.AppSettings["botpattern"]; }
		}

		public static bool LogBots
		{
			get { return (ConfigurationManager.AppSettings["logbots"] != "0"); }
		}
	}
}
